<?php
error_reporting(1);

$target = '/www/wwwroot/website.com'; // 生产环境web目录
$password = 'liqiai88';
$wwwUser = 'www';
$wwwGroup = 'www';


$json = json_decode(file_get_contents('php://input'), true);
if (empty($json['password']) || $json['password'] !== $password) {
    exit('error request');
}

$cmds = array(
    "cd $dir && git pull",
    //"rm -rf $target/* && cp -r $dir/* $target/",
    "chown -R {$wwwUser}:{$wwwGroup} $target/",
);

foreach ($cmds as $cmd) {
    shell_exec($cmd);
}
